package com.youlu.campus.admin.community.controller;

import com.youlu.campus.entity.VO.req.UserActivityTaskInfoQueryListVO;
import com.youlu.campus.entity.VO.req.UserActivityTaskInfoVerifyReq;
import com.youlu.campus.service.activity.UserActivityTaskInfoService;
import com.yuelin.infrastructure.quantum.common.QResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
public class UserActivityTaskInfoController {
    @Autowired
    private UserActivityTaskInfoService userActivityTaskInfoService;

    @PostMapping("/activity/user-task/list")
    public QResult activityList(@RequestBody UserActivityTaskInfoQueryListVO request) {
        try {
            return QResult.success(userActivityTaskInfoService.list(request));
        } catch (Exception e) {
            log.error(":>>> 活动任务列表错误:{}", e);
            return QResult.fail("活动任务列表错误");
        }
    }

    @PostMapping("/activity/user-task/verify")
    public QResult verify(@RequestBody UserActivityTaskInfoVerifyReq request) {
        return QResult.success(userActivityTaskInfoService.verifyTask(request));
    }

    @GetMapping("/activity/user-task/find-one")
    public QResult findOne(@RequestParam("id") String id) {
        return QResult.success(userActivityTaskInfoService.findOne(id));
    }
}